<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<!--{hook admin_flag_post_start.htm}-->
<div class="container-fluid">
<div class="row">
	<div class="col-lg-12">
		<!--{hook admin_flag_post_breadcrumb_before.htm}-->
		<?php if(empty($hide_breadcrumb)) { ?>
        <ol class="breadcrumb d-none d-md-flex text-muted border-left-primary">
			<li class="breadcrumb-item"><a href="<?php echo url('flag-list', '', TRUE);?>"><i class="icon-home text-primary" aria-hidden="true"></i></a></li>
			<?php if ($fid) { ?>
			<li class="breadcrumb-item"><?php echo $forum['name'];?></li>
			<?php } ?>
            <li class="breadcrumb-item"><?php echo $breadcrumb_flag;?></li>
			<!--{hook admin_flag_post_breadcrumb.htm}-->
		</ol>
		<?php } ?>
		<!--{hook admin_flag_post_breadcrumb_after.htm}-->
		<div class="card card-threadlist">
			<div class="card-body">
                <!--{hook admin_flag_post_form_start.htm}-->
                <form action="<?php echo $form_action; ?>" method="post" id="form">
                    <input type="hidden" name="safe_token" value="<?php echo $safe_token;?>" />
                    <!--{hook admin_flag_post_form_before.htm}-->
                    <div class="form-group row">
                        <div class="col-3 col-sm-2">
                            <label class="form-control-label"><?php echo lang('icon');?></label>
                        </div>
                        <div class="col-9 col-sm-10">
                            <div class="media row">
                                <div class="ml-3">
                                    <label class="d-block m-0 img_1">
                                        <img src="<?php echo $thumbnail; ?>" class="rounded" width="100" id="img_1" />
                                        <span style="display: none;">
                                            <!-- multiple="multiple" -->
                                            <input type="file" accept=".jpg,.jpeg,.png" class="w-100" name="icon" value="" data-assoc="img_1" />
                                        </span>
                                    </label>
                                </div>
                                <div class="media-body col-12">
                                    <div class="custom-control custom-checkbox">
                                        <input class="custom-control-input" type="checkbox" id="delete" name="delete" value="1" />
                                        <label class="custom-control-label custom-checkbox" for="delete">
                                            <?php echo lang('delete').lang('icon');?>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--{hook admin_flag_post_form_name_after.htm}-->
                    <div class="form-group row">
                        <label class="col-3 col-sm-2 form-control-label"><?php echo lang('select').lang('column');?></label>
                        <div class="col-9 col-sm-10">
                            <select class="custom-select mr-1 w-auto" name="fid" <?php echo $disabled;?>>
                                <option value="0"><?php echo lang('index_page'); ?></option>
                                <?php foreach ($columnlist as $v) { ?>
                                <option value="<?php echo $v['fid']; ?>"><?php echo $v['name']; ?></option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                    <!--{hook admin_flag_post_form_select_after.htm}-->
                    <div class="form-group row">
                        <label class="col-3 col-sm-2 form-control-label"><?php echo lang('customize_name');?></label>
                        <div class="col-9 col-sm-10">
                            <?php echo $input['name']; ?>
                        </div>
                    </div>
                    <!--{hook admin_flag_post_form_name_after.htm}-->
                    <div class="form-group row">
                        <label class="col-3 col-sm-2 form-control-label"><?php echo lang('show');?></label>
                        <div class="col-9 col-sm-10">
                            <?php echo $input['display']; ?>
                            <p class="small text-muted">
                                <?php echo lang('display_tips');?>
                            </p>
                        </div>
                    </div>
                    <!--{hook admin_flag_post_form_display_after.htm}-->
                    <div class="form-group row">
                        <label class="col-3 col-sm-2 form-control-label"><?php echo lang('display_number');?></label>
                        <div class="col-9 col-sm-10">
                            <?php echo $input['number']; ?>
                        </div>
                    </div>
                    <!--{hook admin_flag_post_form_number_after.htm}-->
                    <div class="form-group text-center mt-4">
                        <button type="submit" class="btn btn-danger btn-block xn-back col-md-3 mx-auto" id="submit" data-loading-text="<?php echo lang('submiting');?>..."> <?php echo lang('submit');?> </button>
                    </div>
                    <!--{hook admin_flag_post_form_after.htm}-->
                </form>
                <!--{hook admin_flag_post_form_end.htm}-->
                <a role="button" class="btn btn-secondary btn-block xn-back col-md-3 mx-auto mb-3" href="javascript:history.back();"><?php echo lang('back');?></a>
                <!--{hook admin_flag_post_back_after.htm}-->
			</div>
		</div>
	</div>
</div>
</div>
<!--{hook admin_flag_post_end.htm}-->

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>
    var fid = <?php echo $fid;?>;
    var select_fid = $('select[name="fid"]');
    select_fid.checked(fid);
    var jform = $('#form');
    /*对文件进行 base64 编码，处理文件上传，很方便*/
    jform.base64_encode_file(500,500,'clip');

    jform.on('submit', function() {
        jform.reset();
        var jthis = $(this);
        var jsubmit = jthis.find('#submit');
        jsubmit.button('loading');
        var postdata = jform.serialize();
        var post_fid = select_fid.checked();
        $.xpost(jform.attr('action'), postdata, function(code, message) {
            if(code == 0) {
                $.alert(message);
                jsubmit.button(message).delay(1000).location(xn.url('flag-list', {fid:post_fid}, true));
            } else if(xn.is_number(code)) {
                $.alert(message);
                jsubmit.button('reset');
            } else {
                jform.find('[name="'+code+'"]').alert(message).focus();
                jsubmit.button('reset');
            }
        });
        return false;
    });

    $('#category').addClass('show');
    $('li.category, .menu-flag').addClass('active').find('a').removeClass('collapsed');
</script>

<!--{hook admin_flag_post_js.htm}-->